﻿using System;
using System.Collections.Generic;
using System.Text;

namespace BBMS.DLL.Base
{
    public enum SQLOperator
    {
        LIKE = 0, 
        GREATER = 1, 
        GREATER_OR_EQUAL = 2,
        EQUAL = 3,
        LOWER_OR_EQUAL = 4,
        LOWER = 5
    }
    public class FilterCondition
    {
        public readonly static string[] Operators = new string[] { " LIKE ", ">", ">=", "=", "<=", "<" };
        public string FieldName;
        public string Alias;
        public object Value;
        public SQLOperator Operator;

        public FilterCondition(string field, string alias, object value, SQLOperator _operator) {
            this.FieldName = field;
            this.Alias = alias;
            this.Value = value;
            this.Operator = _operator;
        }
        public string SQLString
        {
            get
            {
                return string.Format("( {0}{1}@{2} )", FieldName, Operators[(int)Operator],Alias);
            }
        }
    }
}
